package com.volcreate.week1;

import java.util.Scanner;

/**
 * @author zxc
 * @date 2020/9/20
 */
public class Main4 {

    public static void main(String[] args) {
        Scanner In = new Scanner(System.in);
        int x = 1;
        int y = 1;
        int i;
        int n = In.nextInt();

        for (i = 0; i < n - 1; i++) x = x * 10;
        for (i = 0; i < n; i++) y = y * 10;
        for (i = x; i < y; i++) {
            int t = i, sum = 0;
            while (t != 0) {
                int tt = 1;
                for (int j = 0; j < n; j++) tt = tt * (t % 10);
                sum = sum + tt;
                t = t / 10;
            }
            if (sum == i) System.out.println(i);
        }


    }
}
